package com.wyx.wyxusers;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component

public class Receiver {
    //
    @RabbitListener(bindings = @QueueBinding(
            exchange = @Exchange("myElectronics"),
            key = "comput",
            value = @Queue("computElectronics")
    ))
    public void processCmput(String message){
        System.out.println(message);
    }


    /**
     * 手机类       接收消息
     * @param message
     */
    @RabbitListener(bindings = @QueueBinding(
            exchange = @Exchange("myElectronics"),
            key = "phone",
            value = @Queue("phoneElectronics")
    ))
    public void processPhone(String message){
        System.out.println(message);
    }
}

